home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Demos / Simpsons Cartoon Studio™ Demo / Simpsons / Support / dlogdata / save.Dxr / 00004_save dialog box parent.ls < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.4 KB  |  82 lines

  1. property saveButton, cancelButton
  2. global saveDialogBox, fileMgr, PCflag, contentList
  3.  
  4. on birth me
  5.   init(me)
  6.   if PCflag then
  7.     set the textFont of field "filename field" to "Arial"
  8.     set the textSize of field "filename field" to 10
  9.     set the textStyle of field "filename field" to "bold"
  10.     set the textFont of field "credits field" to "Arial"
  11.     set the textSize of field "credits field" to 9
  12.     set the textStyle of field "credits field" to "bold"
  13.   else
  14.     set the textFont of field "filename field" to "Geneva"
  15.     set the textSize of field "filename field" to 10
  16.     set the textStyle of field "filename field" to "bold"
  17.     set the textFont of field "credits field" to "Geneva"
  18.     set the textSize of field "credits field" to 9
  19.     set the textStyle of field "credits field" to "bold"
  20.   end if
  21.   return me
  22. end
  23.  
  24. on init me
  25.   set saveButton to 2
  26.   set cancelButton to 3
  27.   puppetSprite(saveButton, 1)
  28.   puppetSprite(cancelButton, 1)
  29.   repeat with theSprite = 10 to 22
  30.     puppetSprite(theSprite, 1)
  31.   end repeat
  32.   showThumbnails(me)
  33. end
  34.  
  35. on handleButton me, whichSprite
  36.   if hiliteButton(whichSprite) then
  37.     if whichSprite = 2 then
  38.       saveCartoon(me)
  39.     else
  40.       hide(me)
  41.     end if
  42.   end if
  43. end
  44.  
  45. on hide me
  46.   set the modal of saveDialogBox to 0
  47.   forget(saveDialogBox)
  48. end
  49.  
  50. on saveCartoon me
  51.   set theCartoonName to the text of field "filename field"
  52.   set theCartoonCredits to the text of field "credits field"
  53.   if theCartoonName <> EMPTY then
  54.     tell the stage
  55.       writetoonData(fileMgr, theCartoonName, theCartoonCredits)
  56.     end tell
  57.     hide(me)
  58.   else
  59.     beep()
  60.   end if
  61. end
  62.  
  63. on showThumbnails me
  64.   set positionTable to [[54, 54], [90, 54], [90, 90], [54, 90], [18, 90], [18, 54], [18, 18], [54, 18], [90, 18], [126, 18], [126, 54], [126, 90]]
  65.   set bgdThumbnail to getAt(contentList, 1) & ".thumb"
  66.   set the loc of sprite 10 to point(94, 84)
  67.   set the castNum of sprite 10 to the number of cast bgdThumbnail
  68.   set listOfCharacters to getAt(contentList, 2)
  69.   set thumbnailSprite to 11
  70.   set count to 1
  71.   repeat with castThumbnail in listOfCharacters
  72.     set thePoints to getAt(positionTable, count)
  73.     set x to the left of sprite 10 + getAt(thePoints, 1)
  74.     set y to the top of sprite 10 + getAt(thePoints, 2)
  75.     set the loc of sprite thumbnailSprite to point(x, y)
  76.     set the castNum of sprite thumbnailSprite to the number of cast (castThumbnail & ".thumb")
  77.     set thumbnailSprite to thumbnailSprite + 1
  78.     set count to count + 1
  79.   end repeat
  80.   updateStage()
  81. end
  82.